package cn.iocoder.yudao.module.promotion.dal.mysql.yearcardconfig;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.dal.dataobject.yearcardconfig.YearCardConfigDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.promotion.controller.admin.yearcardconfig.vo.*;

/**
 * 年卡配置 Mapper
 *
 * @author 万民匠心
 */
@Mapper
public interface YearCardConfigMapper extends BaseMapperX<YearCardConfigDO> {

    default PageResult<YearCardConfigDO> selectPage(YearCardConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<YearCardConfigDO>()
                .eqIfPresent(YearCardConfigDO::getTitle, reqVO.getTitle())
                .eqIfPresent(YearCardConfigDO::getHeaderPicUrls, reqVO.getHeaderPicUrls())
                .eqIfPresent(YearCardConfigDO::getContent, reqVO.getContent())
                .eqIfPresent(YearCardConfigDO::getOriginalPrice, reqVO.getOriginalPrice())
                .eqIfPresent(YearCardConfigDO::getHavePromotion, reqVO.getHavePromotion())
                .eqIfPresent(YearCardConfigDO::getPromotionPrice, reqVO.getPromotionPrice())
                .eqIfPresent(YearCardConfigDO::getPutType, reqVO.getPutType())
                .eqIfPresent(YearCardConfigDO::getPutTimeStart, reqVO.getPutTimeStart())
                .eqIfPresent(YearCardConfigDO::getPutTimeEnd, reqVO.getPutTimeEnd())
                .eqIfPresent(YearCardConfigDO::getUserAgreement, reqVO.getUserAgreement())
                .betweenIfPresent(YearCardConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(YearCardConfigDO::getId));
    }

}